﻿using RuoVea.ExEnum;
using System;

namespace RuoVea.ExDto;

/// <summary>
/// 创建人：Starry
/// 描 述：RESTful风格 接口响应数据
/// </summary>
public class RestfulResult<T> where T : class
{
    /// <summary>
    /// 状态码
    /// </summary>
    public CodeStatus Code { get; set; } = CodeStatus.OK;

    /// <summary>
    /// 错误信息
    /// </summary>
    public object Message { get; set; }

    /// <summary>
    /// 数据
    /// </summary>
    public T Data { get; set; }

    /// <summary>
    /// 附加数据
    /// </summary>
    public object Extras { get; set; } = null;

    /// <summary>
    /// 时间戳
    /// </summary>
    public long Timestamp { get; set; } = (DateTime.Now.Ticks - new DateTime(1970, 1, 1).Ticks) / 10000000 - 8 * 60 * 60;
}

/// <summary>
/// 创建人：starry
/// 描 述：接口响应数据
/// </summary>
public class RestfulResult
{
    /// <summary>
    /// 状态码
    /// </summary>
    public CodeStatus Code { get; set; } = CodeStatus.OK;
    /// <summary>
    /// 错误信息
    /// </summary>
    public string Message { get; set; }
    /// <summary>
    /// 数据
    /// </summary>
    public object Data { get; set; }

    /// <summary>
    /// 附加数据
    /// </summary>
    public object Extras { get; set; } = null;

    /// <summary>
    /// 时间戳
    /// </summary>
    public long Timestamp { get; set; } = (DateTime.Now.Ticks - new DateTime(1970, 1, 1).Ticks) / 10000000 - 8 * 60 * 60;
}

